[FSSDK-11823] make Activate listener payload type backwards compatible#1081
Merged
[FSSDK-11823] make Activate listener payload type backwards compatible#1081
Conversation
017f8b2 to
37d8258
Compare
5d3e45c to
a3b1912
Compare
e858feb to
2f090cc
Compare
2f090cc to
7b5dc43
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR makes the activate listener payload type backwards compatible with v6.0.0 by separating experiment and holdout fields instead of using a union type.
- Separates the experiment field into distinct
experimentandholdoutfields inActivateListenerPayload - Adds runtime type checking with
isHoldoutfunction to properly populate the correct field - Updates notification handling to conditionally set either experiment or holdout based on the decision object type
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/shared_types.ts | Adds isHoldout type guard function to distinguish between experiments and holdouts |
| lib/optimizely/index.ts | Updates activate notification logic to separate experiment and holdout into distinct fields |
| lib/optimizely/index.tests.js | Updates test expectations to include the new holdout: null field |
| lib/optimizely/index.spec.ts | Updates test spy names and adds validation for the new activate notification payload structure |
| lib/notification_center/type.ts | Modifies ActivateListenerPayload type to have separate experiment and holdout fields |
| lib/feature_toggle.ts | Updates holdout feature toggle and adds conditional type helper |
Comments suppressed due to low confidence (1)
lib/feature_toggle.ts:1
- Import statement references
holdoutandIfActivefrom a file that is being modified in this PR. TheIfActivetype is newly added butholdoutis a function, not a type. This import may cause issues if the function is being used as a type in the import context.
/**
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
junaed-optimizely
approved these changes
Sep 4, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The current type of activate listener payload is not backwards compatible with the type in v6.0.0. This PR makes it compatible.
Test plan
Issues